package com.baomidou.ant.controller;

import com.baomidou.ant.common.Result;
import com.baomidou.ant.entity.DeleteInfo;
import com.baomidou.ant.service.IDeleteInfoService;
import com.baomidou.ant.vo.response.RequestListDeleteInfoVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2022-03-18
 */
@RestController
@RequestMapping("/delete-info")
public class DeleteInfoController {
    @Autowired
    private IDeleteInfoService deleteInfoService;
    @PostMapping("/queryDeleteInfo")
    public Result queryDeleteInfo(){
        List<RequestListDeleteInfoVo> voList=new ArrayList<>();
        List<DeleteInfo> deleteInfoList=deleteInfoService.list();
        for(DeleteInfo deleteInfo:deleteInfoList){
            RequestListDeleteInfoVo vo=new RequestListDeleteInfoVo();
            BeanUtils.copyProperties(deleteInfo,vo);
            voList.add(vo);
        }
        return Result.getSuccess().setData(voList);
    }
}
